package com.li.cn.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import javax.xml.crypto.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: liujiang
 * @Date: 2020/11/29/23:46
 * @Description:读取Excel监听器
 */
public class ExcelListener extends AnalysisEventListener<DemoData> {
    //创建list集合封装最终数据
    List<DemoData> list = new ArrayList<>();

    //一行一行去读取Excel内存
    @Override
    public void invoke(DemoData demoData, AnalysisContext analysisContext) {
        System.out.println("demo"+demoData);
        list.add(demoData);
    }

    //获取表头内容
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println(headMap);
    }

    //读取完成之后执行
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }



}
